// MAPIConcubine.h

#pragma once

using namespace System;
using namespace System::Runtime::InteropServices; 
using namespace Microsoft::Win32 ;
using namespace System::Collections::Generic;
using namespace System::IO;

namespace MAPIConcubine {

	/// <summary>
	/// The Fabric Class defines Methos and Functions to access Extended MAPI Functions from .Net
	/// </summary>
	public ref class Fabric
	{
		// private methods and variables
		private:

		/// <summary>
		/// destructor
		/// </summary>
		~Fabric();

		// all public visible methods
		public:

		/// <summary>
		/// construction code
		/// </summary>
		Fabric();



		/// 
		/// Adds an SMTP header to an outgoing Outlook- Email Message
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook mailItem object.
		/// [in] headerName - the name of the header to add.
		/// [in] headerValue - the value of the header to add.
		void AddMessageHeader(Object^ mapiObject, String^ headerName, String^ headerValue);

		/// 
		/// Reads an SMTP header from an Outlook- Email Message
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook mailItem object.
		/// [in] headerName - the name of the header to retrieve.
		/// [returns] headerValue - the value of the header with the given name.
		String^ ReadMessageHeader(Object^ mapiObject, String^ headerName);

		/// 
		/// Reads the complete SMTP headers from an Outlook- Email Message
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook mailItem object.
		/// [returns] the complete internet transport message headers.
		String^ ReadMessageHeader(Object^ mapiObject);

		/// 
		/// Reads the body  from an Outlook- Email Message
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook mailItem object.
		/// [returns] the complete internet transport message headers.
		Dictionary<String^, Object^>^ ReadSecureData(Object^ mapiObject);

		 
		/// 
		/// Reads the body  from an Outlook- Email Message
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook mailItem object.
		/// [returns] the complete internet transport message headers.
		String^ ReadMessageBody(Object^ mapiObject);
		/// 
		/// Returns the MAPI profilename of the current session.
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the Outlook Application.Session object.
		/// [returns] - the name of the currently used profile.
		String^ Fabric::GetProfileName(Object^ mapiObject);

		/// 
		/// Returns the current MAPI profilenames available in the system registry.
		/// 
		/// [returns] - a string array of all available profilenames.
		array<String^,1>^ Fabric::EnumProfileNames();

		/// Defines the available Colors for AppointmentLabels
		enum class AppointmentLabelColor
		{
			None = 0,				// Default Color
			Important = 1,			// Red
			Business = 2,			// Blue
			Personal = 3,			// Green
			Vacation = 4,			// Grey
			Deadline = 5,			// Orange
			Travel_Required = 6,	// Light-Blue
			Needs_Preparation = 7,	// Grey
			Birthday = 8,			// violett
			Anniversary = 9,		// turquoise
			Phone_Call = 10			// Yellow
		} ;

		/// 
		/// Sets the AppointmentLabelColor for a Outlook- Appointment
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook appointmentItem object.
		/// [in] the desired colortype that you wish to set 	
		void SetAppointmentLabelColor(Object^ mapiObject, AppointmentLabelColor color);
		
		/// 
		/// Sets the AppointmentLabelColor for a Outlook- Appointment
		/// 
		/// [in] mapiObject - the MAPIOBJECT property of the outlook appointmentItem object.
		/// [returns] the current label colortype of the item, default when the value is greater then 10 
		AppointmentLabelColor GetAppointmentLabelColor(Object^ mapiObject);


		/// 
		/// This method takes an MAPI error code as parameter (GetLastError()) and returns the error message as managed string.
		/// 
		/// [in] dw - the MAPI error code.
		/// [returns] - the human readable error message as string.
		String^ GetErrorText(DWORD dw);

	};
}
